// import { createProxyMiddleware } from 'http-proxy-middleware';
// // const createProxyMiddleware = require('http-proxy-middleware');

// const proxyMiddleware = (app) => {
//   app.use(
//     '^/api',
//     createProxyMiddleware({
//       changeOrigin: true,
//       target: 'localhost:9000',
//       pathRewrite: {
//         '^/api': '',
//       },
//     }),
//   );
// };

// export default proxyMiddleware;

const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '^/api',
    createProxyMiddleware({
      target: 'http://localhost:9000',
      changeOrigin: true,
      pathRewrite: {
        '^/api': '',
      },
    }),
  );
};
